﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using PRDP.Tools;
using System.Web.Configuration;
using PRDP;

public partial class MasterPage : System.Web.UI.MasterPage
{
    //页面标题
    protected string webSiteName = CommonConfig.getInstance().getPerpertyValue("websiteName");
    //搜索框显示分类最大个数
    int maxSearchTypeNum = 10;
    protected void Page_Load(object sender, EventArgs e)
    {
        //设置标题
        liteTitle.Text = Request["searchword"] + " - " + webSiteName;        
        //搜索大类分类，显示在搜索框上面
        laSearchTypeHTML.Text = this.loadSearchTypeHTML();
        //预处理
        preProcess();
    }

    /// <summary>
    /// 页头的搜索类型
    /// </summary>
    /// <param name="num"></param>
    /// <returns></returns>
    public string loadSearchTypeHTML()
    {
        string searchTypeHTML = string.Empty;
        searchTypeHTML += "<table width=\"100%\"><tbody><tr>";
        List<Hashtable> rows = MyDBHandler.getAllList("select top " + this.maxSearchTypeNum.ToString() + " CnName,ID from Type where Display='true' order by Rank asc");
        foreach (Hashtable row in rows)
        {
            searchTypeHTML += "<td width=\"" + (row["CnName"].ToString().Length * 15 + 10) + "px\"><a id=\"a" + row["ID"].ToString() + "\" class=\"textA\" href=\"javascript:ajaxTopTypeSearch(" + row["ID"].ToString() + ")\">" + row["CnName"].ToString() + "</a></td>\r\n";
        }
        searchTypeHTML += "<td><a class=\"textA\" href=\"searchmore.aspx\">更多&gt;&gt;</a></td>\r\n";
        searchTypeHTML += "</tr></table>\r\n";
        return searchTypeHTML;
    }

    public void preProcess()
    {

    }
}
